%% Generate 
% This scripts generates WAV files.
% 

%% Music notes
% http://users.rowan.edu/~shreek/networks1/music.html
% The American Standard Pitch for each of this notes is:
% A:    440.00 Hz
% B:    493.88 Hz
% C#:  554.37 Hz
% D:    587.33 Hz
% E:    659.26 Hz
% F#:  739.99 Hz

%% Parameters

basename = 'sound'; %
duration = 5;           % seconds
start_frequency = 400;  % Hz
end_frequency = 1500;   % Hz
freq_increment = 100;   % Hz

Fs = 10000;             % Sampling frequency
T = 1/Fs;               % Sample time
L = duration/T;         % Length of signal

t = (0:L-1)*T;          % Time vector

for frequency = start_frequency: freq_increment: end_frequency
    y = 0.9 * sin(2*pi*frequency*t);
    filename = strcat(basename, '_', num2str(frequency), '.wav')
    wavwrite(y,Fs,filename)
end

